feat: Add Kraftfile schema v0.7 support#2776
feat: Add Kraftfile schema v0.7 support#2776ijaidev wants to merge 8 commits intounikraft:stagingfrom
Conversation
2c18c69 to
a4facbe
Compare
|
Done |
craciunoiuc
left a comment
There was a problem hiding this comment.
just one comment my side, otherwise looks pretty good
needs thorough testing though 😅
|
also try doing a rebase when you have time |
There was a problem hiding this comment.
Pull request overview
Adds Kraftfile schema v0.7 support by introducing a dedicated project loader path, template pre-resolution/merge, and updated runtime/rootfs/ROM plumbing so v0.7 projects can be loaded and built/packaged consistently across CLI workflows.
Changes:
- Add v0.7 project loading/dispatch (including template resolution before mapping) and record loader/spec metadata on the resulting
Application. - Update runtime reference parsing to preserve full OCI references and adjust runtime package lookup accordingly; add unit tests.
- Thread rootfs/ROM filesystem metadata (formats + paths) through targets, initrd generation, packagers, and OCI packaging; normalize build output paths and artifact naming.
Reviewed changes
Copilot reviewed 35 out of 36 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
unikraft/type.go |
Adds shared project-name normalization helper. |
unikraft/target/target.go |
Normalizes target artifact/config names; changes ROM type to v0.7 FS descriptors. |
unikraft/runtime/transform.go |
Uses improved runtime ref splitting for schema strings. |
unikraft/runtime/runtime.go |
Adds query/reference helpers; improves OCI ref parsing behavior. |
unikraft/runtime/runtime_test.go |
Adds coverage for runtime ref parsing + schema transform behavior. |
unikraft/app/volume/transform.go |
Adds support for parsing volume mode. |
unikraft/app/template_resolver.go |
New resolver for v0.7 template pull/parse/merge semantics. |
unikraft/app/project_v07.go |
New v0.7 loader mapping Kraftfile v0.7 into existing application model. |
unikraft/app/project_v07_test.go |
New tests for spec dispatch, template merge, runtime refs, outdir, fs metadata, volumes. |
unikraft/app/project_loader.go |
Introduces spec sniffing + dispatch between legacy and v0.7 loaders. |
unikraft/app/project.go |
Refactors legacy loader into newLegacyProjectFromOptions; records loader/spec version. |
unikraft/app/normalize.go |
Reuses new unikraft.NormalizeProjectName. |
unikraft/app/loader_kind.go |
Adds loader kind enum + mutation-not-supported error. |
unikraft/app/loader.go |
Updates parsing for rootfs type + ROMs to v0.7 FS descriptors. |
unikraft/app/application_options.go |
Extends application options with loader/spec; changes fs/rom option types. |
unikraft/app/application.go |
Extends Application API for loader/spec; makes v0.7 template pre-merged; updates fs/rom types. |
packmanager/pack_options.go |
Switches ROMs from []string to []FS. |
oci/pack.go |
Updates ROM handling to use FS descriptors (currently uses .Source). |
internal/cli/kraft/run/runner_kraftfile_runtime.go |
Uses runtime query/reference helpers for catalog lookups. |
internal/cli/kraft/run/run.go |
Switches rootfs-type flag plumbing to v0.7 FS type. |
internal/cli/kraft/pkg/pull/pull.go |
Avoids nil deref by caching template pointer; respects v0.7 template semantics. |
internal/cli/kraft/pkg/pkg.go |
Switches rootfs-type option type to v0.7 FS type. |
internal/cli/kraft/pkg/packager_kraftfile_runtime.go |
Propagates ROM FS descriptors through packaging + ROM build. |
internal/cli/kraft/menu/menu.go |
Avoids nil deref when template is unavailable/merged. |
internal/cli/kraft/fetch/fetch.go |
Avoids nil deref when template is unavailable/merged. |
internal/cli/kraft/cloud/deploy/deploy.go |
Switches rootfs-type option type to v0.7 FS type. |
internal/cli/kraft/cloud/compose/up/up.go |
Switches rootfs-type option type to v0.7 FS type. |
internal/cli/kraft/cloud/compose/build/build.go |
Switches rootfs-type option type to v0.7 FS type. |
internal/cli/kraft/build/builder_kraftfile_runtime.go |
Uses runtime ref helpers; improves error messages for lookup failures. |
internal/cli/kraft/build/build.go |
Honors project outdir for initrd/kernel output paths; switches rootfs-type option type. |
initrd/rootfs.go |
Changes ROM builder to work on FS descriptors and honor per-ROM/default fs type. |
initrd/options.go |
Replaces initrd FsType with kraftfile v0.7 FsType; updates enums. |
initrd/file.go |
Updates fs type detection return type. |
go.mod |
Adds unikraft.com/x/kraftfile and pins sigs.k8s.io/yaml. |
go.sum |
Updates module checksums for new dependencies. |
Makefile |
Updates formatting target to use golangci-lint’s formatter command. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
I have done decent testing, but I totally agree with you, it needs thorough testing before merging into upstream What should be the next step? more manual testing, or we should write some e2e tests parallel to the legacy parser |
a4facbe to
19cb8a3
Compare
Add the Kraftfile v0.7 parser dependency and the YAML helper it uses so later loader changes can compile against the new schema package. Signed-off-by: Jaidev <himjaidev@gmail.com>
Track which loader produced an application and reject Save, AddLibrary, and RemoveLibrary for non-legacy projects so the new v0.7 loader stays read-only. Signed-off-by: Jaidev <himjaidev@gmail.com>
Split project loading by Kraftfile spec version and add the first v0.7 document mapper for name, core, libraries, targets, rootfs, volumes, and loader metadata. Signed-off-by: Jaidev <himjaidev@gmail.com>
Keep full registry and digest runtime references intact during parsing and query package catalogs with the derived name and version fields used by build and run. Signed-off-by: Jaidev <himjaidev@gmail.com>
Resolve v0.7 templates before converting the document into the Application model so template defaults merge once and project fields continue to win. Signed-off-by: Jaidev <himjaidev@gmail.com>
Normalize target artifact names with the shared project-name helper and reuse the configured project output directory when build moves kernel and initramfs artifacts. Signed-off-by: Jaidev <himjaidev@gmail.com>
19cb8a3 to
ae9a157
Compare
Carry rootfs and ROM filesystem descriptors through app loading, initrd generation, packaging, OCI emission, and CLI flag parsing so v0.7 filesystem metadata is preserved end to end. Signed-off-by: Jaidev <himjaidev@gmail.com>
Change the fmt target to use $(GOCILINT) fmt instead of $(GOCILINT) format as the correct sub-command is fmt. Signed-off-by: Jaidev <himjaidev@gmail.com>
ae9a157 to
1e4e962
Compare
|
Gomod is dirty 🙏
I think try to think of some other unit tests you could add for it. Basically hardcode some kraftfiles and test that it parses them correctly. Include also some I'll try to do some manual testing also of it to gain some confidence in it :D |
craciunoiuc
left a comment
There was a problem hiding this comment.
some other comments my side meanwhile
|
|
||
| // WithRoms sets the application's auxiliary read-only memory blobs. | ||
| func WithRoms(roms ...string) ApplicationOption { | ||
| // WithRomFilesystems sets the application's ROM filesystem descriptors. |
There was a problem hiding this comment.
| // WithRomFilesystems sets the application's ROM filesystem descriptors. | |
| // WithRoms sets the application's ROM filesystem descriptors. |
| type ProjectLoader string | ||
|
|
||
| const ( | ||
| ProjectLoaderLegacy ProjectLoader = "legacy" |
There was a problem hiding this comment.
I would not call it legacy here and in all places
It's actually v0.6, though it's not as standardised
| uk := &unikraft.Context{ | ||
| UK_NAME: name, | ||
| UK_BASE: popts.RelativePath(workdir), | ||
| UK_BASE: popts.workdir, |
There was a problem hiding this comment.
Path no longer relative here?

Add Kraftfile schema v0.7 support
Prerequisite checklist
Description of changes
This PR adds Kraftfile schema v0.7 support across project loading,
template resolution, runtime handling, and packaging flows.
Dispatch project loading by Kraftfile spec version and map v0.7
documents into the existing application model.
Resolve v0.7 templates before application mapping so template
defaults merge correctly while project fields continue to take
precedence.
Preserve full OCI runtime references during parsing and runtime
package lookup.
Keep v0.7 projects read-only for mutation paths that still depend
on the legacy loader.
Normalize target artifact names and honor the configured project
output directory during build flows.
Carry rootfs and ROM filesystem metadata through application
loading, initrd generation, packaging, and OCI manifest creation.
Extend test coverage around spec dispatch, template behavior,
runtime references, output paths, and filesystem metadata
propagation.
Issue Add kraftkit support for v0.7 kraftfile schema #2682